# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=psst
pkgver=0_git20240526
pkgrel=1
_commit="a492c33e5d314b40ef7c6ed6634e4fbe4857a8ad"
pkgdesc="Fast and multi-platform Spotify client with native GUI"
url="https://github.com/jpochyla/psst"
arch="all"
license="MIT"
makedepends="
	alsa-lib-dev
	cairo-dev
	cargo
	cargo-auditable
	gtk+3.0-dev
	openssl-dev
	"
source="https://github.com/jpochyla/psst/archive/$_commit/psst-$_commit.tar.gz
	0001-psst-make-build-reproducible.patch
	"
options="net" # Required to download crates
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/psst-gui "$pkgdir"/usr/bin/psst-gui
	install -Dm755 target/release/psst-cli "$pkgdir"/usr/bin/psst-cli

	install -Dm644 psst-gui/assets/logo_512.png "$pkgdir"/usr/share/icons/hicolor/512x512/apps/psst.png
	install -Dm644 psst-gui/assets/logo_256.png "$pkgdir"/usr/share/icons/hicolor/256x256/apps/psst.png
	install -Dm644 psst-gui/assets/logo_128.png "$pkgdir"/usr/share/icons/hicolor/128x128/apps/psst.png
	install -Dm644 psst-gui/assets/logo_64.png "$pkgdir"/usr/share/icons/hicolor/64x64/apps/psst.png
	install -Dm644 psst-gui/assets/logo_32.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/psst.png
	install -Dm644 psst-gui/assets/logo.svg "$pkgdir"/usr/share/icons/hicolor/scalable/apps/psst.svg

	install -Dm644 .pkg/psst.desktop -t "$pkgdir"/usr/share/applications/
}

sha512sums="
a50523d3dbea73acb3299c09f6e8251dcbc4cf8ae16ae440941f684827f7f936a3506d84e86a9b0d6390b23ae0cadd8c31e7976792342e073a5f9b733e4263e3  psst-a492c33e5d314b40ef7c6ed6634e4fbe4857a8ad.tar.gz
ebb722f0cd2c3c74584060d4f88d67a53349cde528cbdc487cd07c0e583df6da6fda7047a9f97901b0ecf7fcdbc8c07ef266deb048ac80700f8be7124dbceedd  0001-psst-make-build-reproducible.patch
"
